Repository navigation
Conversation
configure_debug_session switched the GDB load to program_esp only when every flash image already existed. `pio debug` configures the session before it builds the firmware, so on the first session of a clean build the bootloader and partition table were missing and GDB fell back to `load`. For ESP-IDF images that writes the new ELF sections into flash through the mapping of the application already there and leaves an image that no longer matches its checksum: on an ESP32-S31 the chip then reset in a loop and never reached app_main. The images are build outputs that exist by the time GDB runs the load commands, so stop requiring them up front. Sessions started on an already built project were not affected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TyrpBtw45nhJDbpwhXbBbd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
configure_debug_sessionswitches the debugger's load step toprogram_esponly when every flash image already exists.pio debugconfigures the session before it builds the firmware, so the first session after a clean build, or on a new environment, finds no bootloader or partition table yet and falls back to GDBload. Depending on the chip,loadthen either fails (Load failed, flash addresses not writable) or writes the new ELF sections into flash through the mapping of the application already there, leaving an image whose checksum no longer matches, so the chip resets in a loop without reachingapp_main. Sessions started on a project that was already built were not affected.The images are build outputs that exist by the time GDB runs the load commands, so the check is dropped.
Tested:
esp32-s3-devkitc-1,debug_tool = esp-builtin, the pinned OpenOCD v0.11.0-esp32-20220706),examples/espidf-hello-world, firstpio debugafterrm -rf .pio:develop: GDB falls back toload, which cannot write the flash sections (Warn : address 0x3c010020 not writable) and ends inLoad failed; the session never starts.program_espwrites and verifies the bootloader, partition table and application (** Verify OK **three times), and the session stops atapp_main.pio debugafter a clean build ran GDBloadand the board reset in a loop; with it, the first session flashes withprogram_esp.esp32devandesp32-c6-devkitm-1with no images built yet: the load commands change fromloadtomonitor program_espfor bootloader, partition table and application, in the format OpenOCD v0.11 expects.